<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('客户评估列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
  <div class="row">
    <div class="col-sm-12 select-table table-striped">
      <table id="bootstrap-table" data-mobile-responsive="true"></table>
    </div>
  </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
  const editFlag = [[${@permission.hasPermi('project:projectCustomerEvaluate:edit')}]];
  const datas = [[${@dict.getType('eval_level')}]];
  const sewageDatas = [[${@dict.getType('sewage_type')}]];
  const prefix = ctx + "project/projectCustomerEvaluate";

  $(function () {
    var options = {
      url: prefix + "/list",
      createUrl: prefix + "/add",
      updateUrl: prefix + "/edit/{id}",
      removeUrl: prefix + "/remove",
      modalName: "客户评估",
      columns: [{
        checkbox: true
      },
        {
          field: 'evaluateId',
          title: '',
          visible: false
        },
        {
          field: 'projectName',
          title: '项目名称'
        },
        {
          field: 'sewageType',
          title: '污水类型',
          formatter: function (value, row, index) {
            return $.table.selectDictLabel(sewageDatas, value);
          }
        },
        {
          field: 'projectPrice',
          title: '项目金额(元)'
        },
        {
          field: 'customerRate',
          title: '综合评估',
          formatter: function (value) {
            if (value) return value + '%';
          }
        },
        {
          field: 'evalType',
          title: '客户价值',
          formatter: function (value, row, index) {
            return $.table.selectDictLabel(datas, value);
          }
        },
        {
          field: 'discountRate',
          title: '折扣率',
          formatter: function (value) {
            if (value) return value + '%';
          }
        },
        {
          field: 'updateTime',
          title: '评估时间'
        },
        {
          title: '操作',
          align: 'center',
          formatter: function (value, row, index) {
            let actions = [];
            if (row.progressCode == '8') {
              actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.evaluateId + '\')"><i class="fa fa-edit"></i>客户评估</a> ');
            }
            return actions.join('');
          }
        }]
    };
    $.table.init(options);
  });
</script>
</body>
</html>